//
//  LeShader.h
//  Leste
//
//  Created by 王乐 on 2022/1/26.
//

#ifndef LeShader_hpp
#define LeShader_hpp

#include "glm/glm.hpp"
#include <string>

class LeShader
{
public:
    LeShader();
    virtual ~LeShader();
    
public:
    unsigned int ID;
    
public:
    void initShaderProgram(const char* vertexPath, const char* fragmentPath);

    void useShader();// activate the shader
    
    // utility uniform functions
    // -------------------------
    void setBool(const std::string &name, bool value) const;
    void setInt(const std::string &name, int value) const;
    void setFloat(const std::string &name, float value) const;
    void setVec3(const std::string &name, float x, float y, float z) const;
    void setVec4(const std::string &name, float a, float b, float c, float d) const;
    void setMat4(const std::string &name, const glm::mat4 &mat) const;
    
private:
    // utility function for checking shader compilation/linking errors.
    // ----------------------------------------------------------------
    void checkCompileErrors(unsigned int shader, std::string type);
};

#endif /* LeShader_hpp */
